before detaching it. Fix a race condition that dom0 was tearing down the
block device while the guest was putting it in a Connected state.
Signed-off-by: Vincent Hanquez <vincent@snarc.org>
else:
return False
+def checkBlockState(domain):
+ s, o = traceCommand("xm block-list %s | awk '{print $4}' |tail -n 1" % domain.getName())
+ if s != 0:
+ FAIL("block-list failed")
+ return int(o)
+
if ENABLE_HVM_SUPPORT:
SKIP("Block-detach not supported for HVM domains")
if not checkXmLongList(domain):
FAIL("xm long list does not show that hda1 was attached")
-time.sleep(2)
+for i in range(1, 10):
+ time.sleep(1)
+ state = checkBlockState(domain)
+ if state == 4:
+ break
s, o = traceCommand("xm block-detach %s hda1" % domain.getName())
if s != 0: